import axios from "axios";
const instance =axios.create({
    baseURL:'http://music.lanlianhua.work',
    withCredentials: true,
    timeout:6000,/*请求超时时间*/
})
// 全局请求拦截
instance.interceptors.request.use(function (config) {
  // 服务端使用www-form-urlencoded编码
    // config.data=qs.stringify(config.data)
    return config;
  }, function (error) {
    return Promise.reject(error);
  });
//   全局响应拦截
instance.interceptors.response.use(function (response) {
    return response.data;
  }, function (error) {
    return Promise.reject(error);
  });
//  get请求
export const get =(url,params)=>instance.get(url,{params})
//  post请求
export const post =(url,data)=>instance.post(url,data)
// delete请求
export const del = (url, params) => instance.delete(url, { params });
//  put请求
export const put =(url,data)=>instance.put(url,data)
// 导出
export default instance